package com.cmc.cloud.cmclink.doc.vo.sovo.sovo;

import cn.hutool.core.collection.CollectionUtil;
import com.cmc.cloud.cmclink.doc.api.document.rep.manifestrep.manifestcntr.ManifestCntrRespVO;
import com.cmc.cloud.cmclink.doc.api.document.rep.manifestrep.manifestscn.ManifestScnRespVO;
import com.cmc.cloud.cmclink.doc.vo.docbkconfirmprintsetupvo.DocBkConfirmPrintSetupRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.attachmentvo.AttachmentRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.operatelog.OperateLogRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.requirementsvo.RequirementsRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.sobcrcheck.SoBcrCheckRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.socargovo.SoCargoRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.socontactvo.SoContactRespVO;
import com.cmc.cloud.cmclink.doc.api.document.req.so.SoForecastRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.sopaymentvo.SoPaymentRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.soscnvo.SoScnRespVO;
import com.cmc.cloud.cmclink.doc.vo.sovo.sovslvoyvo.SoVslvoyRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.List;
import java.util.Map;

/**
 * 订舱主Response VO
 *
 * @author 陈正
 */
@Schema(description = "管理后台 - 订舱 Response detail VO")
@Data
@ToString(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class SoDetailRespVO {
    @Schema(description = "订舱信息")
    private SoRespVO so;
    @Schema(description = "订舱航次路径")
    private List<SoVslvoyRespVO> soVslvoyList;
    @Schema(description = "订舱预配信息")
    private List<SoForecastRespVO> soForecastList;
    @Schema(description = "订舱货物信息")
    private List<SoCargoRespVO> soCargoList;
    @Schema(description = "订舱相关方信息")
    SoScnRespVO soScn;
    @Schema(description = "订舱联系人信息")
    private List<SoContactRespVO> soContactList;
    @Schema(description = "订舱附件")
    private List<AttachmentRespVO> attachmentList;
    @Schema(description = "订舱附加要求")
    private List<RequirementsRespVO> requirementsList;
    @Schema(description = "上一个订舱 可为空")
    private Long previousSo;
    @Schema(description = "下一个订舱 可为空")
    private Long nextSo;
    @Schema(description = "BCR校验list")
    private List<SoBcrCheckRespVO> bcrCheckList;
    @Schema(description = "操作记录 list")
    private List<OperateLogRespVO> operateLogList;
    @Schema(description = "BCR校验总的结果")
    private Boolean checkBcr;
    @Schema(description = "打印配置")
    private DocBkConfirmPrintSetupRespVO confirmPrintSetup;
    @Schema(description = "BookingTime配置")
    private Map<String, String> timeMap;

    @Schema(description = "订舱预配信息 拆合并使用")
    private List<SoForecastRespVO> splitCombineSoForecastList;
    @Schema(description = "订舱货物信息 拆合并使用")
    private List<SoCargoRespVO> splitCombineSoCargoList;

    private List<SoPaymentRespVO> soPaymentList;

    @Schema(description = "箱信息")
    private List<ManifestCntrRespVO> manifestCntrList;
    @Schema(description = "相关方")
    private List<ManifestScnRespVO> manifestScnList;

    public Boolean getCheckBcr() {
        if (CollectionUtil.isNotEmpty(bcrCheckList) && bcrCheckList.stream().filter(e -> e.getCheckStatus() == false).count() > 0) {
            return false;
        }
        return true;
    }
}
